package net.bwie.realtime.douyin.function;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import net.bwie.realtime.douyin.bean.PayViewBean;
import org.apache.flink.api.common.functions.RichMapFunction;

/**
 * 简介说明:
 *
 * @author: LiLi
 * @date: 2025/05/27 10:23:52
 * @version: 1.0
 */
public class PayViewBeanMapFunction extends RichMapFunction<String, PayViewBean> {


    @Override
    public PayViewBean map(String value) throws Exception {

        JSONObject jsonObject = JSON.parseObject(value);

        return new PayViewBean(
                null,
                null,
                jsonObject.getLong("order_id"),
                jsonObject.getLong("order_status"),

                jsonObject.getLong("item_id"),
                jsonObject.getString("item_name"),
                jsonObject.getString("item_Category"),

                jsonObject.getDouble("original_price"),
                jsonObject.getDouble("coupon_price"),
                jsonObject.getDouble("payment_Amount"),

                jsonObject.getString("record_time"),
                jsonObject.getString("record_date"),
                jsonObject.getString("brand_name"),
                jsonObject.getString("province"),
                jsonObject.getString("city"),
                jsonObject.getLong("is_new"),
                jsonObject.getString("os"),
                jsonObject.getString("ch")
        );
    }
}
